package com.wcl.hencodertest

import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.animation.PropertyValuesHolder
import android.os.Bundle
import android.util.Log
import android.view.MotionEvent
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.blankj.utilcode.util.LogUtils
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.activity_main2.*

class MainActivity : AppCompatActivity() {
    companion object {
        val TAG = javaClass.simpleName
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main2)
        var i = 20
        btn_start.setOnClickListener {
//            batteryView.setBatteryPercent(++i)
            batteryView.startCharge()
        }
        btn_stop.setOnClickListener {
            batteryView.stopCharge()
//            batteryView.setBatteryPercent(--i)
        }


//        val topHolder = PropertyValuesHolder.ofFloat("topFlipAngle",-45F)
//        val buttomHolder = PropertyValuesHolder.ofFloat("buttomFlipAngle",45F)
//        val rotationHolder = PropertyValuesHolder.ofFloat("angle",270F)
//
//
//        val topAnimator = ObjectAnimator.ofPropertyValuesHolder(view,topHolder)
//        val buttomAnimator = ObjectAnimator.ofPropertyValuesHolder(view,buttomHolder)
//        val rotationAnimator = ObjectAnimator.ofPropertyValuesHolder(view,rotationHolder)
//        val animatorSet = AnimatorSet()
//        animatorSet.playSequentially(buttomAnimator,rotationAnimator,topAnimator)
//        animatorSet.startDelay = 1000
//        animatorSet.duration = (2_000)
//        animatorSet.start()
//        firstView.setOnClickListener {
//            Log.i(TAG,"firstView 被点击了")
//        }

    }

//    fun onclick(view: View) {
//        editText.isUseFloatingText = !editText.isUseFloatingText
//    }

    override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
        return super.dispatchTouchEvent(ev)
    }

}